package csu.big_article.validation;

import csu.big_article.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class StateValidation implements ConstraintValidator<State,String> {
    /**
     * @param value 将来擦买手机
     * @param context 内容
     *
     * @return 返回
     */

    public String value;

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        //提供校验规则
        if(value == null){
            //那个@param value的值的问题
            System.out.println("value is null");
            return true;
        }else if(value.equals("已发布")||value.equals("草稿")){
             return false;
        }else {
            return false;
        }
    }
}
